/**
 * Created by superv on 2016/10/11.
 */
//全局常量
//     var portalPath="http://139.196.206.3:8089/portal";
    var portalPath="http://localhost:8090/gah-portal";
    //var portalPath="//192.168.1.31:8090/portal";
    var requestPath = window.location.host;

    var ossPath="https://redhorse-lottery.oss-cn-hangzhou.aliyuncs.com/";
    var alertTitle="操作提示";
    var alertReset="重置密码";
    var alertEdit="确认修改？";
    var alertDel="确认删除？";
    var alertRepeal="确认撤销";
    var alertReview="确认审查？";
    var alertCommit="确认提交？";

    var certificate="确认制作证书？";
    var english=["ownerNameEn","shipNameEn","ownerAddressEn","insuranceNameEn","insuranceAddressEn","callsign"];

    var k = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDT7+EGVSDsWNj9PkqzptOwcG9gvbUSfKfkkyNK\n" +
        "3KKlqPMY74YNlWZpD6nozfoWhNTRGEzNCkrshzTM51GJYKs8CQhxwwYiaW9rK1XaTlx+cR/DoUzg\n" +
        "T8pqZvv+u5yIdqLotoYmxLH0iXD9/GEwD77XtDfJPXTLSNOzUtIeDbZ8MwIDAQAB";
//格式化时间为字符串
var dateFormat = function (date) {
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    var d = date.getDate();
    return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
};

//输出格式：yyyy-MM-dd
function getTaskTime(strDate) {
    if(null==strDate || ""==strDate){
        return "";
    }
    var dateStr=strDate.trim().split(" ");
    var strGMT = dateStr[0]+" "+dateStr[1]+" "+dateStr[2]+" "+dateStr[5]+" "+dateStr[3]+" GMT+0800";
    var date = new Date(Date.parse(strGMT));
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = m < 10 ? ('0' + m) : m;
    var d = date.getDate();
    d = d < 10 ? ('0' + d) : d;
    var h = date.getHours();
    return y+"-"+m+"-"+d;
};
//Thu Aug 18 20:38:54 CST 2016，时间格式转换
//输出格式：yyyy-MM-dd HH:mm:ss
function getTaskTime2(strDate) {
    if(null==strDate || ""==strDate){
        return "";
    }
    var dateStr=strDate.trim().split(" ");
    var strGMT = dateStr[0]+" "+dateStr[1]+" "+dateStr[2]+" "+dateStr[5]+" "+dateStr[3]+" GMT+0800";
    var date = new Date(Date.parse(strGMT));
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = m < 10 ? ('0' + m) : m;
    var d = date.getDate();
    d = d < 10 ? ('0' + d) : d;
    var h = date.getHours();
    var minute = date.getMinutes();
    minute = minute < 10 ? ('0' + minute) : minute;
    var second = date.getSeconds();
    second = second < 10 ? ('0' + second) : second;

    return y+"-"+m+"-"+d+" "+h+":"+minute+":"+second;
};

//时间戳格式化 yyyy-MM-dd hh:mm:ss
function formatDateTime(inputTime) {
		var date= new Date(inputTime);
		var y = date.getFullYear();
		var m = date.getMonth() + 1;
		m = m < 10 ? ('0' + m) : m;
		var d = date.getDate();
		d = d < 10 ? ('0' + d) : d;
		var h = date.getHours();
		h = h < 10 ? ('0' + h) : h;
		var minute = date.getMinutes();
		var second = date.getSeconds();
		minute = minute < 10 ? ('0' + minute) : minute;
		second = second < 10 ? ('0' + second) : second;
		return y + '-' + m + '-' + d+' '+h+':'+minute+':'+second;  
	};

function formatDateTime2(inputTime) {
    var date= new Date(inputTime);
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = m < 10 ? ('0' + m) : m;
    var d = date.getDate();
    d = d < 10 ? ('0' + d) : d;
    var h = date.getHours();
    h = h < 10 ? ('0' + h) : h;
    var minute = date.getMinutes();
    var second = date.getSeconds();
    minute = minute < 10 ? ('0' + minute) : minute;
    second = second < 10 ? ('0' + second) : second;
    return y + '.' + m + '.' + d;
};


//解析字符串为时间
var dateParse = function (s) {
    if (!s) {
        return new Date();
    }
    var ss = (s.split('-'));
    var y = parseInt(ss[0], 10);
    var m = parseInt(ss[1], 10);
    var d = parseInt(ss[2], 10);
    if (!isNaN(y) && !isNaN(m) && !isNaN(d)) {
        return new Date(y, m - 1, d);
    } else {
        return new Date();
    }
};

var datetimeFormat=function (date){
    var y = date.getFullYear();
    var m = date.getMonth()+1;
    var d = date.getDate();
    var h = date.getHours();
    var min = date.getMinutes();
    var sec = date.getSeconds();
    var str = y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d)+' '+(h<10?('0'+h):h)+':'+(min<10?('0'+min):min)+':'+(sec<10?('0'+sec):sec);
    return str;// yyyy/MM/dd HH:mm:ss
};

var datetimeFormat2=function (timeStamp){
    var date = new Date();
    date.setTime(timeStamp);
    var str=datetimeFormat(date);
    return str;
};


var datetimeParse = function (s) {
    if (!s) return new Date();
    var s1 = s.split(" ")[0];
    var s2 = s.split(" ")[1];
    var ss1 = s1.split("-");
    var ss2 = s2.split(":");
    var y = parseInt(ss1[0], 10);
    var m = parseInt(ss1[1], 10);
    var d = parseInt(ss1[2], 10);
    var h = parseInt(ss2[0], 10);
    var min = parseInt(ss2[1], 10);
    var sec = parseInt(ss2[2], 10);
    if (!isNaN(y) && !isNaN(m) && !isNaN(d) && !isNaN(h) && !isNaN(min) && !isNaN(sec)) {
        return new Date(y, m - 1, d, h, min, sec);
    } else {
        return new Date();
    }
};


var datetimeParse2 = function (s) {
    if (!s) return new Date();
    var s1 = s.split(" ")[0];
    var s2 = s.split(" ")[1];
    var ss1 = s1.split("-");
    var ss2 = s2.split(":");
    var y = parseInt(ss1[0], 10);
    var m = parseInt(ss1[1], 10);
    var d = parseInt(ss1[2], 10);
    var h = parseInt(ss2[0], 10);
    var min = parseInt(ss2[1], 10);
    if (!isNaN(y) && !isNaN(m) && !isNaN(d) && !isNaN(h) && !isNaN(min) ) {
        return new Date(y, m - 1, d, h, min);
    } else {
        return new Date();
    }
};


//格式化时间为字符串
var dateFormat3 = function (date) {
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    var d = date.getDate();
    return y + '年' + (m < 10 ? ('0' + m) : m) + '月' + (d < 10 ? ('0' + d) : d)+'日';
};
//格式化时间为字符串  yyyy-mm-dd hh:mm
var dateFormat2 = function (date) {
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    var d = date.getDate();
    var h = date.getHours();
    var min = date.getMinutes();
    return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d)+' '+(h < 10 ? ('0' + h) : h)+':'+(min < 10 ? ('0' + min) : min);
};


var dateFormat4 = function (date) {
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    var d = date.getDate();
    return y + '-' +  m + '-' + (d < 10 ? ('0' + d) : d);
};


//解析字符串为时间
var dateParse = function (s) {
    if (!s) {
        return new Date();
    }
    var ss = (s.split('-'));
    var y = parseInt(ss[0], 10);
    var m = parseInt(ss[1], 10);
    var d = parseInt(ss[2], 10);
    if (!isNaN(y) && !isNaN(m) && !isNaN(d)) {
        return new Date(y, m - 1, d);
    } else {
        return new Date();
    }
};


var datetimeParse=function (s){
    if (!s) return new Date();
    var s1 = s.split(" ")[0];
    var s2 = s.split(" ")[1];
    var ss1 = s1.split("-");
    var ss2 = s2.split(":");
    var y = parseInt(ss1[0], 10);
    var m = parseInt(ss1[1], 10);
    var d = parseInt(ss1[2], 10);
    var h = parseInt(ss2[0], 10);
    var min = parseInt(ss2[1], 10);
    var sec = parseInt(ss2[2], 10);
    if (!isNaN(y) && !isNaN(m) && !isNaN(d) && !isNaN(h) && !isNaN(min) && !isNaN(sec)) {
        return new Date(y, m - 1, d, h, min, sec);
    } else {
        return new Date();
    }
};



function back(){
        window.history.back();
}

var array=["jpg","JPG","jpeg","JPEG","png","PNG","bmp","BMP"];
function checkFileType(obj) {
  var picPath = obj.value;
  if(picPath==""||picPath==undefined||picPath==null){
    $.alert({
      title:alertTitle,
      content:"请选择上传的文件！"
    });
    return false;
  }
  if(!checkType(picPath,array)){
    obj.value="";
    return false;
  }
  return true;
}
var array2=["xls","xlsx"];
function checkFileType2(obj) {
    var picPath = obj.value;
    if(picPath==""||picPath==undefined||picPath==null){
        $.alert({
            title:alertTitle,
            content:"请选择上传的文件！"
        });
        return false;
    }
    if(!checkType(picPath,array2)){
        obj.value="";
        return false;
    }
    return true;
}
function checkType(picPath,array){
  var fileTypeStr=array.join(",");
  var type = picPath.substring(picPath.lastIndexOf(".") + 1, picPath.length).toLowerCase();
  var typeFlag=false;
  for(var i=0;i<array.length;i++){
    if(type==array[i]){
      typeFlag=true;
      break;
    }
  }
  if (!typeFlag) {
    $.alert({
      title:alertTitle,
      content:"请上传正确的文件格式("+fileTypeStr+")"
    });
    return false;
  }
  return true;
}



function openTarget(url){
    window.open(requestPath+url,"iframe");
}

function isEmpty(obj){
  if(obj==null||obj==undefined||obj==""){
    return true;
  }
  return false;
}





/**
 * Created by o551w on 2017/6/20.
 */

var alertError="操作失败";
//非法字符判断
function InputDatacheck(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var pattern = new RegExp("[~'!@#$%^&*()-+=]");
    if (pattern.test(value)) {
        data.right = false;
        data.errorReason = '不能输入非法字符！';
    }
    return data;
}
function InputDatacheck2(value) {//去括号
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var pattern = new RegExp("[~'!@#$%^&*-+=]");
    if (pattern.test(value)) {
        data.right = false;
        data.errorReason = '不能输入非法字符！';
    }
    return data;
}
function InputDatacheck3(value) {//去括号
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var pattern = new RegExp("[~'!/()<>;@#$%^&*-+\"]");
    if(nullCheck(value).right){
        if (pattern.test(value)) {
            data.right = false;
            data.errorReason = '不能输入非法字符！';
        }
    }
    return data;
}
function InputDatacheck4(value) {//去括号
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var pattern = new RegExp("[~'!/()<>;@#$%^&*-+\"]");
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }else if (pattern.test(value)) {
            data.right = false;
            data.errorReason = '不能输入非法字符！';
        }
    return data;
}

function InputDatacheckGoodsPara(value) {//去括号
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var patternGoodsPara = new RegExp("[~'!/()<>;@#$%^&\"]");
    if(nullCheck(value).right){
        if (patternGoodsPara.test(value)) {
            data.right = false;
            data.errorReason = '不能输入非法字符！';
        }
    }
    return data;
}


function InputDatacheckGoodsName(value) {//去括号
    //value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var patternGoods = new RegExp("[~'!/<>;@#$%^&\"]");
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }else if (patternGoods.test(value)) {
            data.right = false;
            data.errorReason = '不能输入非法字符！';
        }
    return data;
}



//文字、英文字母、数字验证
function stringSubCheck(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if (!/^[a-zA-Z0-9\u4E00-\u9FA5]+$/.test(value)) {
        data.right = false;
        data.errorReason = '只能包括中文字、英文字母、数字！';
    }
    return data;
}

function stringSubCheck3(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if (!/^[a-zA-Z0-9\u4E00-\u9FA5-+]+$/.test(value)) {
        data.right = false;
        data.errorReason = '只能包括中文字、英文字母、数字！';
    }
    return data;
}

function stringSubCheck2(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if (nullCheck(value).right) {
        if (!/^[a-zA-Z0-9\u4E00-\u9FA5]+$/.test(value)) {
            data.right = false;
            data.errorReason = '只能包括中文字、英文字母、数字！';
        }
    }

    return data;
}
//英文字母、数字验证
function englishSubCheck(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if (value === null || value === undefined || value === '') {
        data.right = false;
        data.errorReason = '不能为空！';
    }
    if (!/^[a-zA-Z0-9]+$/.test(value)) {
        data.right = false;
        data.errorReason = '只能包括英文字母和数字！';
    }
    return data;
}
//英文字母、数字验证
function englishSubCheck2(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if (nullCheck(value).right){
        if (!/^[a-zA-Z0-9]+$/.test(value)) {
            data.right = false;
            data.errorReason = '只能包括英文字母和数字！';
        }
    }
    return data;
}
//大写英文字母、数字验证
function englishSubCheck3(value) {
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if (nullCheck(value).right){
        if (value.indexOf('"') != -1) {
            data.right = false;
            data.errorReason = '请勿输入英文双引号！';
        }
    }
    return data;
}
//大写英文字母、数字验证
function englishSubCheck4(value) {
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if (value === null || value === undefined || value === '') {
        data.right = false;
        data.errorReason = '不能为空！';
    }
    if (value.indexOf('"') != -1) {
        data.right = false;
        data.errorReason = '请勿输入英文双引号！';
    }
    return data;
}
//手机验证
function Phonecheck(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if (!/^1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9])\d{8}$/.test(value) && !/^([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/.test(value)) {
        data.right = false;
        data.errorReason = '请输入正确的手机号码！';
    }
    return data;
}
//检索手机验证
//手机验证
function Phonecheck1(value) {
    value = $.trim(value);//消除空格
    var reg=/^[0-9]+$/
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if(value==null||value==""||value==undefined) {
        return data;
    }else if (!reg.test(value)||value.length>11) {
        data.right = false;
        data.errorReason = '请输入正确的手机号码！';
    }
    return data;
}

//手机验证
function Phonecheck3(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if(value==null||value==""||value==undefined){
        data.right = false;
        data.errorReason = '手机号码不能为空！';
    } else if (!/^0?(13[0-9]|14[5-9]|15[012356789]|166|17[0-8]|18[0-9]|19[1,8,9])[0-9]{8}$/.test(value)) {
        data.right = false;
        data.errorReason = '请输入正确的手机号码！';
    }
    return data;
}
function Phonecheck2(value) {
    value = $.trim(value);//消除空格
    var data = {

        "right" : true,
        "errorReason" : ''
    };
    if(nullCheck(value).right) {
        if (!/^0?(13[0-9]|14[5-9]|15[012356789]|166|17[0-8]|18[0-9]|19[8-9])[0-9]{8}$/.test(value) ) {
            data.right = false;
            data.errorReason = '请输入正确的手机号码！';
        }
    }
    return data;
}
//密码格式判断
function Passwordcheck(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '密码不能为空！';
    }else if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,18}$/.test(value)) {
        data.right = false;
        data.errorReason = '密码是由6-18位字母和数字组合！';
    }
    return data;
}
//密码格式判断
function Passwordcheck2(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };

    if (!/(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])^[\x00-\xff]{8,16}$/.test(value)) {
        data.right = false;
        data.errorReason = '密码是由8-16位大写，小写字母和数字组合！';
    }
    return data;
}
function companyNameCheck(value) {
    var pattern = new RegExp("[~'!@#$%^&*-+_=:]");
    var data = {
        "right": true,
        "errorReason": ''
    };
    if(pattern.test(value)){
        data.right = false;
        data.errorReason = '不能输入非法字符！';
    } else if (isEmpty(value)){
        data.right = false;
        data.errorReason = '不能为空！';
    }
    return data;
}

function nullCheck(value){
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }
    return data;
}
function nullCheck2(value){
    var val = $.trim(value);//消除空格
    if(val === null || val === undefined || val === ''){
       return '';
    }
    return value;
}
function nullCheck3(value){
    if(value === null || value === undefined || value === ''){
        return '';
    }
    return value;
}
function numberCheck(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var numberTest = /^\d+(\.\d+)?$/;
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }else if(!numberTest.test(value)){
        data.right = false;
        data.errorReason = '必须是数字！';
    }else if(parseInt(value)>9999999){
        data.right = false;
        data.errorReason = '不能大于9999999！';
    }
    return data;
};
function numberCheck2(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var numberTest = /^\d+(\.\d+)?$/;
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }else if(!numberTest.test(value)){
        data.right = false;
        data.errorReason = '必须是数字！';
    }
    return data;
};

function numberCheck3(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var numberTest = /^\d+(\.\d+)?$/;
    if(nullCheck(value).right) {
        if (!numberTest.test(value)) {
            data.right = false;
            data.errorReason = '必须是数字！';
        }
    }
    return data;
};
function numberCheck4(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var intTest=/^([0-9]\d*)$/;
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }else if(!intTest.test(value) || parseInt(value)<1){
        data.right = false;
        data.errorReason = '必须是大于0的整数！';
    }
    return data;
};

function numberCheck5(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var intTest=/^([1-9]\d*|[0]{1,1})$/;
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }else if(!intTest.test(value)){
        data.right = false;
        data.errorReason = '必须是0或正整数！';
    }
    return data;
};
function intCheck(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var intTest = /^\d+$/;
     if(!intTest.test(value) || parseInt(value)<1){
        data.right = false;
        data.errorReason = '必须是正整数！';
    }else if(parseInt(value)>9999999){
        data.right = false;
        data.errorReason = '不能大于9999999！';
    }
    return data;
};


function arrayNullCheck(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if(value.length === 0){
        data.right = false;
        data.errorReason = '必须选择';
    }
    return data;
};


function wordCheck(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var str = /^[\u4e00-\u9fa5]+$/;
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }else if(!str.test(value)){
        data.right = false;
        data.errorReason = '请输入汉字！';
    }
    return data;
};

//汉字和数字
function wordCheck3(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var str = /^[\u4e00-\u9fa50-9]+$/;
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }else if(!str.test(value)){
        data.right = false;
        data.errorReason = '请输入汉字和数字！';
    }
    return data;
};
//汉字和数字
function wordCheck2(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var str = /^[\u4e00-\u9fa50-9]+$/;
    if(nullCheck(value).right){
        if(!str.test(value)){
            data.right = false;
            data.errorReason = '请输入汉字和数字！';
        }
    }

    return data;
};

function englishCheck(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var str = /^[a-zA-Z]+$/;

    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }else if(!str.test(value)){
            data.right = false;
            data.errorReason = '请输入英文！';
        }
    return data;
}
function englishCheck2(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var str = /^[a-zA-Z]+$/;
    if(nullCheck(value).right){
        if(!str.test(value)){
            data.right = false;
            data.errorReason = '请输入英文！';
        }
    }
    return data;
}


function nameCheck(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var str = /^[a-zA-Z、\u4e00-\u9fa5]+$/;
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }else if(!str.test(value)){
        data.right = false;
        data.errorReason = '只能输入汉字，字母！';
    }
    return data;
};
function nameCheck2(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var str = /^[a-zA-Z、\u4e00-\u9fa5]+$/;
    if(nullCheck(value).right){
        if(!str.test(value)){
            data.right = false;
            data.errorReason = '只能输入汉字，字母！';
        }
    }
    return data;
};


function inputCheck(value){
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var str = /^[a-zA-Z0-9、\u4e00-\u9fa5]+$/;
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }else if(!str.test(value)){
        data.right = false;
        data.errorReason = '只能输入汉字，字母，数字！';
    }
    return data;
};

function inputCheck3(value){
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var pattern = new RegExp("[~'!@#$%^&*()-+=]");
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }else if (pattern.test(value)) {
        data.right = false;
        data.errorReason = '不能输入非法字符！';
    }
    return data;
};
function inputCheck2(value){
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var str = /^[a-zA-Z0-9、\u4e00-\u9fa5]+$/;
    if(nullCheck(value).right){
        if(!str.test(value)){
            data.right = false;
            data.errorReason = '只能输入汉字，字母，数字和下划线！';
        }
    }

    return data;
};
function inputCheck4(value){
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }
   /* var str = new RegExp("[~$%^&*'<>=|]");
    if(nullCheck(value).right){
        if(str.test(value)){
            data.right = false;
            data.errorReason = '不能输入非法字符！';
        }
    }*/

    return data;
};

function inputCheck5(value){
    value = $.trim(value);//消除空格
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    /*var str = new RegExp("[~$%^&*'<>=|]");
    if(nullCheck(value).right){
        if(str.test(value)){
            data.right = false;
            data.errorReason = '不能输入非法字符！';
        }
    }*/
    return data;
};
//去除空格
String.prototype.trim = function () {
    return this .replace(/^\s\s*/, '' ).replace(/\s\s*$/, '' );
};

function mobileNumberCheck(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var str = /^[a-zA-Z0-9\\-]+$/;
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }else if(!str.test(value)){
        data.right = false;
        data.errorReason = '只能输入数字，英文和横线！';
    }
    return data;
};
/*去掉空格*/
function Trim(str)
{
    return str.replace(/(^\s*)|(\s*$)/g, "");
}
function mobileNumberCheck2(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var str = /^[a-zA-Z0-9\\-]+$/;
    if(nullCheck(value).right) {
        if (!str.test(value)) {
            data.right = false;
            data.errorReason = '只能输入数字，英文和横线！';
        }
    }
    return data;
};

function emailCheck2(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var szReg=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if(value === null || value === undefined || value === ''){
        data.right = true;
    }else if(!szReg.test(value)){
        data.right = false;
        data.errorReason = '邮箱格式不正确';
    }
    return data;
};
function emailCheck3(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    var szReg=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if(nullCheck(value).right) {
        if (!szReg.test(value)) {
            data.right = false;
            data.errorReason = '邮箱格式不正确';
        }
    }
    return data;
};


function decimalsCheck(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if (value.substring(value.length-1,value.length)=="."){
        data.right = false;
        data.errorReason = '只能输入数字，支持小数点后两位';
        return data;
    }
    var szReg=/^\d+\.?\d{0,2}$/ ;
    if(value === null || value === undefined || value === ''){
        data.right = true;
    }else if(!szReg.test(value)){
        data.right = false;
        data.errorReason = '只能输入数字，支持小数点后两位';
    }
    return data;
};
function decimalsCheck2(value){
    // value= Number(value);
    console.log(value);
    var data = {
        "right" : true,
        "errorReason" : ''
    };

    if(nullCheck(value).right) {
        if (value.substring(value.length-1,value.length)=="."){
            data.right = false;
            data.errorReason = '只能输入数字，支持小数点后两位';
            return data;
        }
        var szReg=/^\d+\.?\d{0,2}$/ ;
        if (!szReg.test(value)) {
            data.right = false;
            data.errorReason = '只能输入数字，支持小数点后两位';
        }
    }
    return data;
};







function pageBack(){
    console.log("history "+ window.history);
    window.history.back();
};

function IDCardCheck(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if(!checkCard(value)){
        data.right = false;
        data.errorReason = '格式不正确！';
    }
    if(value === null || value === undefined || value === ''){
        data.right = false;
        data.errorReason = '不能为空！';
    }
    return data;
}
function IDCardCheck2(value){
    var data = {
        "right" : true,
        "errorReason" : ''
    };
    if(nullCheck(value).right) {
        if(!checkCard(value)){
            data.right = false;
            data.errorReason = '格式不正确！';
        }
    }

    return data;
}

function checkCard(card){
    var vcity={ 11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",
        21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",
        33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",
        42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",
        51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",
        63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"
    };

    //检查号码是否符合规范，包括长度，类型
    function isCardNo(card){
        //身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
        var reg = /(^\d{15}$)|(^\d{17}(\d|X)$)/;
        if(reg.test(card) === false) {
            return false;
        }
        return true;
    }

    //取身份证前两位,校验省份
    function checkProvince(card){
        var province = card.substr(0,2);
        if(vcity[province] === undefined)
        {
            return false;
        }
        return true;
    }

    //检查生日是否正确
    function checkBirthday(card){
        var len = card.length;
        //身份证15位时，次序为省（3位）市（3位）年（2位）月（2位）日（2位）校验位（3位），皆为数字
        if(len === 15) {
            var re_fifteen = /^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/;
            var arr_data = card.match(re_fifteen);
            var year = arr_data[2];
            var month = arr_data[3];
            var day = arr_data[4];
            var birthday = new Date('19'+year+'/'+month+'/'+day);
            return verifyBirthday('19'+year,month,day,birthday);
        }
        //身份证18位时，次序为省（3位）市（3位）年（4位）月（2位）日（2位）校验位（4位），校验位末尾可能为X
        if(len === 18) {
            var re_eighteen = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/;
            var arr_data1 = card.match(re_eighteen);
            var year1 = arr_data1[2];
            var month1 = arr_data1[3];
            var day1 = arr_data1[4];
            var birthday1 = new Date(year1+'/'+month1+'/'+day1);
            return verifyBirthday(year1,month1,day1,birthday1);
        }
        return false;
    }

    //校验日期
    function verifyBirthday(year,month,day,birthday){
        var now = new Date();
        var now_year = now.getFullYear();
        var yearInt = parseInt(year);
        var monthInt = parseInt(month);
        var dayInt = parseInt(day);
        //年月日是否合理
        if(birthday.getFullYear() === yearInt && (birthday.getMonth() + 1) === monthInt && birthday.getDate() === dayInt)
        {
            //判断年份的范围（3岁到100岁之间)
            var time = now_year - year;
            if(time >= 3 && time <= 100)
            {
                return true;
            }
            return false;
        }
        return false;
    }

    //校验位的检测
    function checkParity(card){
        //15位转18位
        card = changeFivteenToEighteen(card);
        var len = card.length;
        if(len === 18)
        {
            var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
            var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
            var cardTemp = 0, i, valnum;
            for(i = 0; i < 17; i ++)
            {
                cardTemp += card.substr(i, 1) * arrInt[i];
            }
            valnum = arrCh[cardTemp % 11];
            if (valnum === card.substr(17, 1))
            {
                return true;
            }
            return false;
        }
        return false;
    }

    //15位转18位身份证号
    function changeFivteenToEighteen(card){
        if(card.length === 15)
        {
            var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
            var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
            var cardTemp = 0, i;
            card = card.substr(0, 6) + '19' + card.substr(6, card.length - 6);
            for(i = 0; i < 17; i ++)
            {
                cardTemp += card.substr(i, 1) * arrInt[i];
            }
            card += arrCh[cardTemp % 11];
            return card;
        }
        return card;
    }

    //开始身份证校验
    //是否为空
    if(card === ''){
        return false;
    }
    //校验长度，类型
    if(isCardNo(card) === false) {
        return false;
    }
    //检查省份
    if(checkProvince(card) === false) {
        return false;
    }
    //校验生日
    if(checkBirthday(card) === false) {
        return false;
    }
    //检验位的检测
    if(checkParity(card) === false) {
        return false;
    }
    return true;
}

function listTextFormat(data, type, full, meta) {
    return data==null?"":'<span title='+data+' style="display:block; width:100%; overflow:hidden;white-space:nowrap; text-overflow:ellipsis;" >'+data+'</span>';
};

function openUrl(url){
    window.location.href=requestPath+url;
};

function reload(){
    window.location.reload();
}
function skip(url){
    window.location.href=url;
};
function dowload(url){
    window.location.href = "http://"+window.location.host+requestPath+filePath+url;
}

function noPic(){
    var img=event.srcElement;
    img.src="../images/empty_img.jpg";
    img.onerror=null;
}


// 过滤富文本中的HTML标签和空格之类，获取纯文本
function filteringHTML(html){
    var text = html;
    if(text != null && text !="" && text.length != 0){
        text = text.replace(/(\n)/g, "");
        text = text.replace(/(\t)/g, "");
        text = text.replace(/(\r)/g, "");
        text = text.replace(/<\/?[^>]*>/g, "");
        text = text.replace(/[ ]/g, "");
        text = text.replace(/\s*/g, "");
    }
    return text;
}

// 过滤富文本中的HTML标签，保留文本和a标签及img标签   用于判断富文本提交时
function filteringRichTextbox(html){
    var text = html;
    if(text != null && text !="" && text.length != 0){
        text = text.replace(/(\n)/g, "");
        text = text.replace(/(\t)/g, "");
        text = text.replace(/(\r)/g, "");
        text = text.replace(/[<（?img|a|p|br|/p|/a）.*?>]/g,"");
        text = text.replace(/[ ]/g, "");
        text = text.replace(/\s*/g, "");
    }
    return text;
}

/**
 * 查找通知
 * @param id
 */
function lookNotices(id) {
    window.location.href = requestPath + "/toNotice?id=" + id;
}

/**
 * 批量选择要删除的数据
 * @param checkboxAllDom
 */
function checkboxClick(checkboxAllDom){
    $("#"+checkboxAllDom).click(function(){
        $(":checkbox").prop("checked",this.checked);
    });
    $(document).on("click",$(":checkbox"),function () {
        var notCheckedNum = $(":checkbox:not(#"+checkboxAllDom+"):not(:checked)").length;
        $("#"+checkboxAllDom).prop("checked", notCheckedNum>0?false:true);
    });
}
/**
 * 获取复选框选中的值
 * @param checkboxAllDom
 * @returns {string}
 */
function getBatchDel(checkboxAllDom){
    var checked = [];
    console.log($(":checkbox:not(#"+checkboxAllDom+"):checked"));
    $(":checkbox:not(#"+checkboxAllDom+"):checked").each(function () {
        checked.push($(this).val());
    });
    console.log(checked);
    return checked.join(",");
}


function inputToJson(fields){
    var json="{";

    for(var i=0;i<fields.length;i++){
        if(fields[i]=="date"){
            json+="\""+fields[i]+"\":\""+$("#startDate").val()+" "+$("#startPoint").val()+"~"+$("#endDate").val()+" "+$("#endPoint").val();
            json+=" "+$("#timeZone").val()+"\"";
        }else if(fields[i]=="route"){
            json+="\"route\":\""+$("input[name='route']:checked").val()+"\"";
        }else if(english.indexOf(fields[i])>=0){
            json+="\""+fields[i]+"\":\""+$("#"+fields[i]).val().toUpperCase()+"\"";
        }else{
            json+="\""+fields[i]+"\":\""+$("#"+fields[i]).val()+"\"";
        }
        if(i<fields.length-1){
            json+=",";
        }
    }
    json+="}";
    return json;
}
function inputToJson2(fields){
    var json="{";

    for(var i=0;i<fields.length;i++){
        if(fields[i]=="date"){
            json+="\""+fields[i]+"\":\""+$("#startDate").val()+" "+$("#startPoint").val()+"~"+$("#endDate").val()+" "+$("#endPoint").val();
            json+=" "+$("#timeZone").val()+"\"";
        }else{
            json+="\""+fields[i]+"\":\""+$("#"+fields[i]).val()+"\"";
        }
        if(i<fields.length-1){
            json+=",";
        }
    }
    json+="}";
    return json;
}
var datetimeFormatNew=function (date){
    var y = date.getFullYear();
    var m = date.getMonth()+1;
    var d = date.getDate();
    var str = y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
    return str;// yyyy/MM/dd
};


/**
 * 根据动态表单获取项目/活动/船舶名称
 * @param list
 */
function inputName(list){
    var name='';
    if(nullCheck(list).right){
        for(var i=0;i<list.length;i++){
            if(list[i].KEY=="项目名称"){
                name=$("#"+list[i].NAME+"").val();
                break;
            }else if(list[i].KEY=="活动名称"){
                name=$("#"+list[i].NAME+"").val();
            }else if(list[i].KEY=="中文船名"){
                if (nullCheck(name).right)
                    break;
                name=$("#"+list[i].NAME+"").val();
            }
        }
    }

    return name;
}


//表单动态验证
function checkInput(list){
//表单表数组
    // console.log(list);
//     var input=["projectName","applyName","shorelineUse","shorelineArea","contacts","constructionUnit","sponsor",
//         "startDate","endDate","siteRange","operatingShip","oldOperatingShip","updateOperatingShip","licenseValidityDate",
//         "applyDelayDate","activityName","operationUnit","participatingShip","wartersDestination","tractionLength",
//         "tractionWeight","scoping","deadline","flyReason","shipName","nationality","endDate","endDate","endDate"];,"ownerAddressCn","insuranceAddressCn"
    var word=["shipNameCn","ownerNameCn","insuranceNameCn"];
    var english=["ownerNameEn","shipNameEn","ownerAddressEn","insuranceNameEn","insuranceAddressEn"];
    // var number=["mmsi","IMO"];
    // var mobile=["contactsInformation","IMO"];
    var time=["date"];
    var route=["route"];
    var decimals=["totalWeight","shipCrosston1","shipCrosston2","grossTonnage","allShipWeight"];

    var data = {
        "right" : true,
        "errorReason" : '',
        "name":''
    };
    if(!nullCheck(list).right||list.length<=0){
        return data;
    }
    for(var i=0;i<list.length;i++){
        // console.log(list[i].NAME);
        if(word.indexOf(list[i].NAME)>=0){
            if (list[i].REQUIRED==1){
                data=wordCheck3($("#"+list[i].NAME+"").val());
            }else if(list[i].REQUIRED==0){
                data=wordCheck2($("#"+list[i].NAME+"").val());
            }
            if(!data.right){
                data.name=list[i].KEY;
                break;
            }
        }else if(english.indexOf(list[i].NAME)>=0){
            if (list[i].REQUIRED==1){
                data=englishSubCheck4($("#"+list[i].NAME+"").val());
            }else if(list[i].REQUIRED==0){
                data=englishSubCheck3($("#"+list[i].NAME+"").val());
            }
            if(!data.right){
                data.name=list[i].KEY;
                break;
            }
        }else if(decimals.indexOf(list[i].NAME)>=0){
            if (list[i].REQUIRED==1){
                data=decimalsCheck($("#"+list[i].NAME+"").val());
            }else if(list[i].REQUIRED==0){
                data=decimalsCheck2($("#"+list[i].NAME+"").val());
            }
            if(!data.right){
                data.name=list[i].KEY;
                break;
            }
        }
        else if(route.indexOf(list[i].NAME)>=0){
            continue;
        }
        else if(time.indexOf(list[i].NAME)>=0){
            if (list[i].REQUIRED==1){
                if(!nullCheck($('#startDate').val()).right||!nullCheck($('#endDate').val()).right){
                    data.right = false;
                    data.name="";
                    data.errorReason = '请选择开始期限和结束期限！';
                    break;
                }
            }else if(list[i].REQUIRED==0){
                if(nullCheck($('#startDate').val()).right!=nullCheck($('#endDate').val()).right){
                    data.right = false;
                    data.name="";
                    data.errorReason = '请选择开始期限和结束期限！';
                    break;
                }
            }
        }else{
            if (list[i].REQUIRED==1){
                data=nullCheck($("#"+list[i].NAME+"").val());
            }
            if(!data.right){
                data.name=list[i].KEY;
                break;
            }
        }
    }
    return data;
}




function hidePop(id) {
    $("#"+id).hide();
}

function showPop(id) {
    $("#"+id).show();
}
function orgCodeCheck(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right": true,
        "errorReason": ''
    };
    if(nullCheck(value).right) {
        if (!/[^_IOZSVa-z\W]{2}\d{6}[^_IOZSVa-z\W]{10}$/g.test(value)) {
            data.right = false;
            data.errorReason = '请输入正确的统一社会信用代码或组织机构代码！';
        }
    }
    return data;
}

function orgCodeCheck2(value) {
    value = $.trim(value);//消除空格
    var data = {
        "right": true,
        "errorReason": ''
    };
    if (!/[^_IOZSVa-z\W]{2}\d{6}[^_IOZSVa-z\W]{10}$/g.test(value)) {
        data.right = false;
        data.errorReason = '请输入正确的统一社会信用代码或组织机构代码！';
    }
    return data;
}

function showTips(name) {
    $(".tips_popop", parent.document).html('<div class="tips_popop_content small_popup" >'+name+'</div>');
    $(".tips_popop", parent.document).slideDown().delay(500).fadeOut(400);
}

function closePop(id) {
    $("#" + id).hide();
}

function logout() {
    $.confirm({
        title: alertTitle,
        content: "是否要退出系统？",
        confirm: function () {
            logoutAjax();
        }
    });
}

function logoutAjax() {
    $.ajax({
        url: requestPath+"/logout",
        success: function (result) {
            window.location.href=requestPath+"/";
        }
    });
}

function goToPage(url) {
    $(this).siblings().removeClass();
    $(this).addClass("current");
    // var type = getType($(this).text());
    openTarget(url);
}

//图片预览
function lookBigImg(b){
    $(".showImg", parent.document).attr("src", '');
    $(".shadeImg",parent.document).fadeIn(500);
    $(".showImg",parent.document).attr("src",requestPath+filePath+b);
    // $(".showImg",parent.document).attr("src","http://198.11.18.54:8443/gah-mgr/public/viewFile?file="+b);
}

//门户图片预览
function lookPortalBigImg(b){
    $(".showImg", parent.document).attr("src", '');
    $(".shadeImg",parent.document).fadeIn(500);
    $(".showImg",parent.document).attr("src",portalFilePath+b);
}
/*
 关闭弹出层
 * */
function closeShade(){
    $(".shade",parent.document).fadeOut(500);
}
/*
 关闭弹出层
 * */
function closeShadeImg(){
    $(".shadeImg",parent.document).fadeOut(500);
}

/**
 * 清除非法字符
 * @param id
 */
function checkData(id) {
    var text = $("#"+id).val().trim();
    console.info(text);
    text = text.replace(/[`~！￥·!@#\$%\^\&\*\(\)_\+<>《》？，。；、‘’ “”【】{}|（）=\?:\"\{\},\.\-\\\/\\\/;\'\[]/,'');
    $("#"+id).val(text);
}



function IEVersion() {
    var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
    var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
    var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
    var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
    if(isIE) {
        var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
        reIE.test(userAgent);
        var fIEVersion = parseFloat(RegExp["$1"]);
        if(fIEVersion == 7) {
            return 7;
        } else if(fIEVersion == 8) {
            return 8;
        } else if(fIEVersion == 9) {
            return 9;
        } else if(fIEVersion == 10) {
            return 10;
        } else {
            return 6;//IE版本<=7
        }
    } else if(isEdge) {
        return 'edge';//edge
    } else if(isIE11) {
        return 11; //IE11
    }else{
        return -1;//不是ie浏览器
    }
}
function dateChange(obj){
    if($("input:hidden[name="+obj+"]").val()==null){
        return true;
    }
    var time = $("input:hidden[name="+obj+"]").val().split(" ")[1];
    var date = "";
    var flag = true;
    var content = "";
    $("."+obj).each(function(index){
        if(index==0){
            if(!numberCheck5($(this).val()).right){
                flag = false;
                content = "年份"+numberCheck5($(this).val()).errorReason;
                $(this).val("");
                return false;
            }
            date+=$(this).val()+"-";
        }
        if(index==1){
            if(!numberCheck4($(this).val()).right){
                flag = false;
                content = "月份"+numberCheck4($(this).val()).errorReason;
                $(this).val("");
                return false;
            }
            if( parseInt($(this).val())>12){
                flag = false;
                content = "月份不能大于12！";
                $(this).val("");
                return false;
            }
            date+=$(this).val()+"-";
        }
        if(index==2){
            if(!numberCheck4($(this).val()).right){
                flag = false;
                content = "日数"+numberCheck4($(this).val()).errorReason;
                $(this).val("");
                return false;
            }
            if( parseInt($(this).val())>31){
                flag = false;
                content = "日数不能大于31！";
                $(this).val("");
                return false;
            }
            date+=$(this).val()+" ";

        }
    });
    if(!flag){
        $.alert({
            title:alertError,
            content:content
        });
        return false;
    }
    $("input:hidden[name="+obj+"]").val(date+time);
    return true;
}

function closeJsp(){
    // window.opener=null;
    window.close();
}

function numberToTime(number,zone){
    if(zone=="格林威治时间")
        zone='GMT';
    else
        zone='';
    console.log(zone);
    if (number=="午时")
        return "NOON "+zone;
    var str=["0:00","1:00","2:00","3:00","4:00","5:00","6:00","7:00","8:00","9:00","10:00","11:00","12:00","13:00",
        "14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00","24:00"];
    var numbers=number.split("时");
    for(var i=0;i<numbers.length;i++){
        if(numberCheck2(numbers[i]).right){
            return str[numbers[i]]+" "+zone;
        }
    }
}


//根据屏幕设定html字体
(function (doc, win) {
    var docEl = doc.documentElement,
        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
        recalc = function () {
            var clientWidth = docEl.clientWidth;
            if (!clientWidth) return;
            docEl.style.fontSize = 100 * (clientWidth / 750) + 'px';
        };
    if (!doc.addEventListener) return;
    win.addEventListener(resizeEvt, recalc, false);
    doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);
// 禁用字体缩放 android
(function() {
    if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
        handleFontSize();
    } else {
        if (document.addEventListener) {
            document.addEventListener("WeixinJSBridgeReady", handleFontSize, false);
        } else if (document.attachEvent) {
            document.attachEvent("WeixinJSBridgeReady", handleFontSize);
            document.attachEvent("onWeixinJSBridgeReady", handleFontSize);
        }
    }
    function handleFontSize() {
        WeixinJSBridge.invoke('setFontSizeCallback', { 'fontSize' : 0 });
        WeixinJSBridge.on('menu:setfont', function() {
            WeixinJSBridge.invoke('setFontSizeCallback', { 'fontSize' : 0 });
        });
    }
})();
